package com.autumn.platform.dao.binding.handler.impl;

import org.apache.ibatis.annotations.Flush;
import org.apache.ibatis.session.SqlSession;

import com.autumn.platform.dao.binding.handler.IMapperHandlerContext;

public class FlushMapperHandler extends AbstractMapperHandler {

    public FlushMapperHandler() {
        super();
    }

    public FlushMapperHandler(int order) {
        super(order);
    }

    @Override
    public boolean supports(IMapperHandlerContext context) {
        return context.getMethod().getAnnotation(Flush.class) != null;
    }

    @Override
    public Object execute(SqlSession sqlSession, Object[] args, IMapperHandlerContext context) {
        return sqlSession.flushStatements();
    }

}
